﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Database.Model.Customers>" %>

<%@ Import Namespace="CRM.Resourses" %>


<% Html.DevExpress().GridView(settings =>
                                    {
                                        settings.Name = "gdContracts";
                                        settings.KeyFieldName = "IdContract";
                                        settings.CallbackRouteValues =
                                            new { Controller = "Contracts", Action = "CustomerContractsPartial",  customerId = Model.IdCustomer  };
                                        settings.SettingsPager.PageSize = 20;
                                       
                                        settings.Columns.Add(column =>
                                                                 {
                                                                     column.Caption = Resourses.LegalEntityName;
                                                                     column.FieldName = "LegalEntityName";
                                                                 });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.ContractType;
                                            column.FieldName = "ContractTypeNameLocalized";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.ContractNumber;
                                            column.FieldName = "ContractNumber";
                                        });


                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.ContractStatuse;
                                            column.FieldName = "ContractStatusNameLocalized";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.ContractLink;
                                            column.FieldName = "";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.ContractScanLink;
                                            column.FieldName = "ScanLink";
                                        });

                                       

                                       

                                        
                                        //Добавление редактирования
                                        //settings.CommandColumn.Visible = true;
                                        //settings.CommandColumn.NewButton.Visible = true;
                                        //settings.CommandColumn.DeleteButton.Visible = true;
                                        //settings.CommandColumn.EditButton.Visible = true;
                                        //settings.SettingsBehavior.ConfirmDelete = true;
                                        //settings.Settings.ShowFilterRow = true;
                                        //settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "Dictionaries", Action = "ProfineEssentialElementsPartialUpdate" };
                                        //settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "Dictionaries", Action = "ProfineEssentialElementsPartialAdd" };
                                        //settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "Dictionaries", Action = "ProfineEssentialElementsPartialDelete" };
                                        settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
                                        settings.Width = Unit.Percentage(100);
                                    }).Bind(Model.Contracts).GetHtml();
                                    
                                    
                                    %>